package com.example.testdemo.Dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class bookDao {
    private static String url="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC";
    private static String username="root";
    private static String pwd = "";
    public static Connection connection() throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.cj.jdbc.Driver");
        Connection connection = DriverManager.getConnection(url,username,pwd);
        return connection;
    }

    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        System.out.println(connection());
    }
}
